<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
 String contextPath = request.getContextPath();
%>
<html>
<head>
<meta http-equiv=content-type content="text/html; charset=UTF-8">
<s:head theme="ajax"/>
<title>仅售218元！原价298元的【法国原装隆爵特选干红】750ml！传统工艺精心酿制，甘醇馥郁无尽享受！ | 特優家团</title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" href="<%=contextPath%>/css/css.css" type="text/css"/>
<script type="text/javascript" src="<%=contextPath%>/js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="<%=contextPath%>/js/javascript.js"></script>
<script type="text/javascript" src="<%=contextPath%>/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>

<script type="text/javascript">

tinyMCE.init({
	// General options
	language : "zh-cn",
	mode : "exact",
	elements : "details",
	theme : "advanced",
	plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

	// Theme options
	theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
	theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
	theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
	theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,

	// Example content CSS (should be your site CSS)
	content_css : "css/content.css",

	// Drop lists for link/image/media/template dialogs
	template_external_list_url : "lists/template_list.js",
	external_link_list_url : "lists/link_list.js",
	external_image_list_url : "lists/image_list.js",
	media_external_list_url : "lists/media_list.js",

	// Style formats
	style_formats : [
		{title : 'Bold text', inline : 'b'},
		{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
		{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
		{title : 'Example 1', inline : 'span', classes : 'example1'},
		{title : 'Example 2', inline : 'span', classes : 'example2'},
		{title : 'Table styles'},
		{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
	],

	// Replace values for the template plugin
	template_replace_values : {
		username : "Some User",
		staffid : "991234"
	}
});

function checkElement(){
	//alert($('#title').html()); 
    if($("#title").html() == ''){
		alert("请输入产品名");
		$("#title")[0].focus();
		return false;
	}
    if($("#file").val() == ''){
    	alert("请输入产品图片");
    	$("#file")[0].focus();
    	return false;
    }
	if($("#realPrice").val() == ''){
		alert("请输入产品实际购买价格");
		$("#realPrice")[0].focus();
		return false;
	}
	if($("#originalPrice").val() == ''){
		alert("请输入产品原始价格");
		$("#originalPrice")[0].focus();
		return false;
	}
	var effecTime = dojo.widget.byId("effecTime");
	if(effecTime.getValue() == ''){
		alert("请输入产品有效起始时间");
		return false;
	}
	var expiredTime = dojo.widget.byId("expiredTime");
	if(expiredTime.getValue() == ''){
		alert("请输入产品结束时间");
		return false;
	}
	if($("#reminder").val() == ''){
		alert("请输入产品提示");
		$("#reminder")[0].focus();
		return false;
	}
	if($("#highlights").val() == ''){
		alert("请输入产品亮点");
		$("#highlights")[0].focus();
		return false;
	}
	if($("#minNum").val() == ''){
		alert("请输入产品最低团购认输");
		$("#minNum")[0].focus();
		return false;
	}
	
	return true;
}

function calDiscount(){
	
	var realPrice = $("#realPrice").val();
	var originalPrice = $("#originalPrice").val();
	if(realPrice !='' && originalPrice !=''){
		if(parseFloat(realPrice)>parseFloat(originalPrice)){
			//alert('realPrice:'+realPrice);
			//alert('originalPrice:'+originalPrice);
			alert("你填写的购买价格大于实际价格，请重新填写");
			$("#realPrice").val("");
			$("#originalPrice").val("");
			$("#originalPrice")[0].focus();
		}else{
			var discount = Math.round(parseFloat(realPrice/originalPrice)*1000)/100;
			$("#discount").val(discount);
			$("#save").val(originalPrice-realPrice);
		}
		
	}
}

function checkmoney(str){
	var re=/^[\d.]*$/;
	if(!re.test(str.value)){
		alert("您输入的金额格式不正确，请重新输入");
		str.value='';
		return false;
	}
}
</script>
<meta name="description" content="<li>原装品质尊贵享受；</li><li>传统酿制芳香怡人；</li><li>酒体优雅入口柔顺；</li><li>收结悠长香味持久。</li>" />
</head>
<body class="bg-alt">
<s:form action="productUpdate!editProduct" method="post" enctype="multipart/form-data" theme="simple">
<s:hidden name="productId"></s:hidden>
<s:hidden name="mainPic"></s:hidden>
<s:hidden name="flag" value="1"></s:hidden>
<div >
  <div id="doc">
  <jsp:include page="/template/top.jsp"></jsp:include>
  <div style="color: red"><s:actionerror/></div>
  <div id="bd" class="cf">
      <div id="deal-default">
        <div id="content">
          <!-- product information start-->
          <div id="deal-intro" class="cf">
            <h1><s:textarea id="title" name="title" cols="40" cssStyle="font-size: 20px" value="请输入产品名"  theme="simple"></s:textarea></h1>
            <div class="main">
              <div class="deal-buy">
                <div class="deal-price-tag"></div>
                <p class="deal-price"><s:textfield id="realPrice" name="realPrice" label="购买价" cssStyle="height:29px" size="5" onblur="checkmoney(this);calDiscount();" theme="simple"></s:textfield>
                 <span id="buylist_now">
                 <img src="<%=contextPath%>/imgs/button-deal-buy.gif" />
                 </span> 
                </p>
              </div>
              <table class="deal-discount">
                <tr>
				  <th>原价</th>
				  <th>折扣</th>
				  <th>节省</th>
				</tr>
				<tr>
				  <th style="padding-top: 5px;"><s:textfield id="originalPrice" name="originalPrice" size="4" onblur="calDiscount();" theme="simple"></s:textfield></th>
				  <th style="padding-top: 5px;"><s:textfield id="discount" name="discount" size="4" readonly="true" theme="simple"></s:textfield></th>
				  <th style="padding-top: 5px;"><s:textfield id="save" name="save" size="4" readonly="true" theme="simple"></s:textfield></th>
				</tr>
              </table>
			  <table width="100%">
			  <Tr>
				  <Td id="showlisttime"><div class="deal-box deal-timeleft deal-off" id="deal-timeleft">
				  <h3>本团购结有效时间</h3>
				  <div class="limitdate">
				    <p class="deal-buy-ended"><s:datetimepicker id="effecTime" name="effectTime" label="起始时间" displayFormat="yyyy-MM-dd '00:00:00'" theme="simple"></s:datetimepicker></p>
				    <p class="deal-buy-ended"><s:datetimepicker id="expiredTime" name="expiredTime" label="终止时间" displayFormat="yyyy-MM-dd '23:59:59'" theme="simple"></s:datetimepicker></p>
				    <p>本团购最低购买数量<s:textfield size="3" id="minNum" name="minNum" value="0"></s:textfield> </p>
				    <p>单笔最高购买数量<s:textfield size="3" id="limitNum" name="limitNum" value="0"></s:textfield></p>
				    <p>本团购总共产品数量	<s:textfield size="3" id="minNum" name="minNum" value="0"></s:textfield> </p>
				  </div>
				  </div>
				  </Td>
			  </Tr>
            </table>
            </div>
            <div class="side">
            <s:if test="%{productPicUploaded}">
            <div class="deal-buy-cover-img">
                <img width="440px" height="250px" src="${mainPic}">
            </div>          	
			</s:if>
			<s:else>
			    <div><s:label value="请上传产品主图片"></s:label><s:file id="file" name="file"></s:file></div>
			</s:else>
              
              <ul class="deal-detail-t cf">
                <li class="col first">
                  <h2>提示<span style="color:red">(请以分号;分割语句)</span></h2>
                  <s:textarea id="reminder" name="reminder"  cols="25" rows="5"   theme="simple"></s:textarea>
                </li>
                <li class="col">
                  <h2>亮点<span style="color:red">(请以分号;分割语句)</span></h2>
                  <s:textarea id="highlights" name="highlights"  cols="25" rows="5"   theme="simple"></s:textarea>
                </li>
              </ul>
            </div>
          </div>
          <!-- product information end -->
          <div id="deal-stuff" class="cf">
            <div class="box box-split">
              <div class="box-top"  > </div>
              <!-- product detail start -->
              
              <div class="box-content cf" >      
                  <div>
                  <!-- here is the detail description of product -->      
                      <textarea id="details" name="details" rows="20" style="width: 100%">
						<s:property value="details"/>
					  </textarea>    
                  </div>
                <div class="clear"></div>
              </div>
              <!-- product detail end -->
              <div class="box-bottom">
                <div class="go-top" style=""><a href="#doc"><span class="top-arrow">↑</span>顶部</a></div>
                <div><s:submit value="保存" onclick="return checkElement();"></s:submit></div>
              </div>
            </div>
          </div>
        </div>
        
        <div id="sidebar">
		<div class="sbox side-invite-tip">
            <div class="sbox-top"></div>
            <div class="sbox-content">
              <div class="tip">
                 <h2>邀请有奖</h2>
                <p class="text">每邀请一位好友首次购买，您将获<strong><span class="money">¥</span>5</strong>元返利</p>
                <p class="link"><a href="http://www.wanletuan.com/account/referrals/">&raquo; 点击获取您的专用邀请链接</a></p>
              </div>
            </div>
            <div class="sbox-bottom"></div>
          </div>
          <div class="clear"></div>
          <div class="sbox side-business">
  <div class="sbox-top"></div>
  <div class="sbox-content">
    <div class="tip">
      <h2>特優家团公告</h2>
      <p ><p class="MsoNormal" style="margin: 0cm 0cm 0pt">
	<strong>【到期提醒】</strong></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt">
	&nbsp;<span style="font-size: 14px"><span style="color: #b22222"><font face="Arial"><strong>焱春拌饭馆</strong><span style="color: #000">11年4月22日到期，0311-80691280。</span></font></span></span></p>
<hr />
<p class="MsoNormal" style="margin: 0cm 0cm 0pt">
	<font color="#000000"><span style="font-size: 14px"><span style="color: #b22222"><span style="color: #b22222"><span style="font-size: 14px">温馨提示：购买后请在玩乐证的有效期内及时消费，特别注意消费截止日期，谨防过期作废！</span></span></span></span></font></p>
<hr />
<p class="MsoNormal" style="margin: 0cm 0cm 0pt">
	<span style="font-size: 16px"><span style="color: #000"><strong><span style="font-size: 14px"><strong><span style="color: #f00">欢迎加入特優家团团友群，和达人们分享团购生活！</span></strong></span></strong></span></span></p>
<p>
	<span style="font-size: 14px"><span style="color: #000"><strong><strong><strong><strong><span style="color: #000"><strong><strong><strong><strong>特優家团团友群：112174067</strong></strong></strong></strong></span></strong></strong></strong></strong></span></span></p>
<p>
	<span style="font-size: 14px"><span style="color: #000"><strong><strong><strong><strong><span style="color: #000"><strong><strong><strong><strong>客服QQ：910643872</strong></strong></strong></strong></span></strong></strong></strong></strong></span></span></p>

    </div>
  </div>
  <div class="sbox-bottom"></div>
</div>
<div class="clear"></div>

          <div class="deal-consult sbox">
            <div class="sbox-bubble"></div>
            <div class="sbox-top"></div>
            <div class="sbox-content">
              <div class="deal-consult-tip">
                <h2>特優家团答疑</h2>
                <p class="nav"><a href="http://www.wanletuan.com/message/" target="_blank">查看全部(367)</a> | <a href="http://www.wanletuan.com/message/#consult-form-head" target="_blank">我要提问</a></p>
                <ul class="list">
                 <li><a href="http://www.wanletuan.com/message/#consult-entry-528">转让2张世纪公园弹跳床或空中漫步的票！12号到期！在家专门带孩子的妈妈可以带孩子去玩！需要的电话联系15081165349</a></li><li><a href="http://www.wanletuan.com/message/#consult-entry-517">转：【3小时欢唱不限时段 6瓶珠江啤酒 2份小吃 1份中果盘】！到【晶木练歌广场平安店】补交65元，即可享受原价300元的欢唱套餐！唱响欢乐时刻！ QQ：13732235 口令：晶木KTV</a></li><li><a href="http://www.wanletuan.com/message/#consult-entry-515">玩乐证怎样办，是必须买过东西吗</a></li>
                </ul>
                <div class="custom-service">
                  <p class="im"><a id="service-msn-help" target="_blank" href="msnim:chat?contact=wanletuankefu@qq.com">
                  <img src="http://www.wanletuan.com/template/default/images/button-custom-msn.gif" /></a> 
                  <a href="http://sighttp.qq.com/cgi-bin/check?sigkey=" target="_blank" onClick="var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey=';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}"><img SRC="http://www.wanletuan.com/template/default/images/button-custom-qq.gif" alt=""></a>
                  </p>
                  	<p class="tel">客服电话：如有售后问题，请加QQ1489380311</p>
				  <p class="time">周一至周六     上午9:00-12:00             下午14:00-18:00</p>
                </div>
              </div>
            </div>
            <div class="sbox-bottom"></div>
          </div>
		  
		    <div class="sbox side-business-tip" style="margin-top:12px;">
                <div class="sbox-top"></div>
                <div class="sbox-content">
                    <div class="tip">
                    <h2>商务合作</h2>
                    <p class="text">希望在特優家团组织团购么？请<a href="http://www.wanletuan.com/feedback/seller/">提交团购信息</a></p>
                    </div>
                </div>
                <div class="sbox-bottom"></div>
            </div> 
 			
        </div>
      </div>
    </div>
    <!-- bd end -->
    <jsp:include page="/template/bottom.jsp"></jsp:include>
  </div>
  <!-- doc end -->
</div>

</s:form>
</body>
</html>